package com.midele.goodstuff.ui.record

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.constraintlayout.compose.ConstraintLayout
import com.midele.goodstuff.R
import com.midele.goodstuff.ui.component.CommBackArrow
import com.midele.goodstuff.ui.theme.Black12
import com.midele.goodstuff.ui.theme.WhiteC8
import com.midele.goodstuff.ui.theme.YellowFC

@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable
fun RecordResultScreen() {
    ConstraintLayout(modifier = Modifier.fillMaxSize()) {

        val (backTitleLayout, infoLayout) = createRefs()

        Image(
            painter = painterResource(id = R.drawable.ic_main_bg), // 替换为你的图片资源ID
            contentDescription = "Background Image", // 图片描述，对于无障碍很重要
            contentScale = ContentScale.Crop, // 图片填充模式，根据你的需求选择合适的模式
            modifier = Modifier
                .fillMaxSize() // 使图片填充整个Box大小
        )

        CommBackArrow(
            modifier = Modifier
                .constrainAs(backTitleLayout) {
                    start.linkTo(parent.start)
                },
            title = "传承登记",
            onClick = {

            }
        )

        Column (modifier = Modifier
            .padding(start = 50.dp, end = 50.dp)
            .constrainAs(infoLayout) {
                top.linkTo(backTitleLayout.bottom, 64.dp)
                start.linkTo(parent.start)
                end.linkTo(parent.end)
            },
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Top,
            ){
            Image(
                painter = painterResource(id = R.mipmap.ic_record_success), // 替换为你的图片资源ID
                contentDescription = "Background Image", // 图片描述，对于无障碍很重要
                contentScale = ContentScale.Fit, // 图片填充模式，根据你的需求选择合适的模式
                modifier = Modifier.size(120.dp)
            )
            Text(
                text = "登记申请已提交",
                color = Color.White,
                fontSize = 18.sp,
                fontWeight = FontWeight.Bold,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .align(Alignment.CenterHorizontally)
            )
            Text(
                text = "您提交的物品「[物品名称]」权属登记申请已成功受理，进入审核队列。",
                color = WhiteC8,
                fontSize = 14.sp,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .align(Alignment.CenterHorizontally)
                    .padding(top = 8.dp)
            )
            Text(
                text = "平台专家将进行审核，预计需要1-3个工作日，请耐心等待。您可在【登记记录】中查看审核状态。",
                color = WhiteC8,
                fontSize = 14.sp,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .align(Alignment.CenterHorizontally)
                    .padding(top = 8.dp, bottom = 36.dp)
            )

            Button(
                onClick = {

                },
                modifier = Modifier
                    .height(50.dp)
                    .fillMaxWidth(),
                shape = RoundedCornerShape(100.dp),
                colors = ButtonDefaults.buttonColors(containerColor = YellowFC)
            ) {
                Text("继续登记", color = Black12, fontSize = 18.sp, fontWeight = FontWeight.Bold)
            }

            Spacer(modifier = Modifier.height(20.dp))

            OutlinedButton(
                onClick = {

                },
                modifier = Modifier
                    .height(50.dp)
                    .fillMaxWidth()
                ,
                shape = RoundedCornerShape(100.dp),
                border = BorderStroke(1.dp, YellowFC),
            ) {
                Text("前往登记记录", color = YellowFC, fontSize = 18.sp)
            }

        }

    }
}

